<template>
	<view class="box">
		<view class="box_offer text-center" v-for="(item,index) in offerlist" :key="(index)" >
			<view class="kong_border"></view>
			<block v-for='(initem,inindex) in item.images' :key='inindex'>
				<image class="image_ph" :src="picture.getImgUrl(initem) " mode=""></image>
			</block>
			<view class="text_ofer flexs2" >
				<view class="ofer_left">{{item.title}}</view>
				<view class="offer_right" @click="tocenter(item.id)">立即查看</view>
			</view>
		</view>
		<view class="nothing text-center" v-if="offerlist.length == 0">
			<image src="../../static/image/offerxq_img_k@2x.png" mode=""></image>
			<view class="">
				暂无信息
			</view>
		</view>
	</view>
</template>

<script>
	import {offerdata} from '@/api/index.js'
	export default {
		data() {
			return {
				page:1,
				limit:10,
				offerlist:[]
			}
		},
		onLoad() {
			this._getoffer()
		},
		methods: {
			_getoffer(){
				let obj = {
					page:this.page,
					limit:this.limit
				}
				offerdata(obj).then(res=>{
					if(res.code == 1){
						if(this.page == 1){
							this.offerlist = res.data
						}else{
							this.offerlist = this.offerlist.concat(res.data) 
						}
					}else{
						this.$msg(res.msg)
					}
				})
			},
			tocenter(id) {
				uni.navigateTo({
					url:"offercenter?id="+id
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.box {
		width: 100%;
		height: 100%;
		background-color: #F5F5F5;
	}
	.box_offer{
		text-align: center;
	}
	.kong_border {
		width: 100%;
		height: 20rpx;
		background-color: #F5F5F5;
	}
	.image_ph {
		width: 690rpx;
		height: 302rpx;
		border-radius: 12rpx;
		border-radius: 10rpx 10rpx 0rpx 0rpx;
	}
	.text_ofer {
		width: 690rpx;
		height:70rpx;
		background-color: #FFFFFF;
		border-radius: 0px 0px 10rpx 10rpx;
		margin: 0 auto;
		margin-top: -6rpx;
		padding: 0 20rpx;
	}
	.ofer_left {
		font-size: 26rpx;
		color: #333333;
	}
	.offer_right {
		color: #333333;
		width: 115rpx;
		line-height: 45rpx;
		background: #FFDD47;
		border-radius: 6rpx;
		font-size: 22rpx;
	}
	.nothing image {
		width: 354rpx;
		height: 253rpx;
	}
	.nothing {
		color: #666666;
		font-size: 26rpx;
		margin-top: 200rpx;
	}
</style>
